import React, { Component } from "react";
import {
  InputNumber,
  Checkbox,
  Divider,
  DatePicker,
  Form,
  Input,
  Select,
  Radio,
  Row,
  Col,
  TreeSelect,
  message,
  Modal, Spin
} from "antd";
import { connect } from "dva";
import "./RightTwo.scss";
import Uploads from "./Upload";
import UploadDu from "./UploadDu";
import moment from "moment";
import { getConfig, weixinMpList } from "../../../services/fetch";
import { noImg } from "../../../utils/request";
const TreeNode = TreeSelect.TreeNode;
const FormItem = Form.Item;
const Option = Select.Option;
const RadioGroup = Radio.Group;
const { TextArea } = Input;

@connect(({ add, theme }) => ({
  add: add,
  theme: theme
}))
class RightTwo extends React.PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      radioValue: 1,
      radioValue2: 0,
      showCover: 1,
      editData: "",
      editDatas: [],
      scanNum: 0,
      forwardNum: 0,
      thumbsNum: 0,
      forwardNumPro: 0,
      thumbsNumPro: 0,
      scanNumPro: 0,
      config_json: {},
      mplist: []
    };
    this.getFieldsValue = this.getFieldsValue.bind(this);
  }
  componentDidMount() {

    getConfig().then((res) => { //取全局配置
      if (res.data.code == 200) {
        let { config_json } = res.data.data;
        // console.log(config_json)

        this.setState({
          config_json
        })
        this.props.dispatch({
          type: 'add/configJson', data: config_json
        })

      } else {
        message.error('全局配置加载失败!');
      }
    })

    this.props.onRef(this);
    let userinfo = localStorage.getItem("userInfo");
    //编辑名称默认为登陆管理员
    if (userinfo) {
      if (typeof userinfo === "string") {
        userinfo = JSON.parse(userinfo);
      }

      this.props.form.setFieldsValue({
        editor: userinfo.real_name
      });
    }

    window.PubSub.subscribe("pushDataToContent2", this.pushDataToContent);
  }
  componentDidUpdate() {
    if (
      this.props.add.configJson.weixinPushSwitch &&
      this.props.add.configJson.weixinUrl
    ) {
      this.getMpList();
    }
  }

  pushDataToContent = item => {
    // console.log(item);
    this.props.form.setFieldsValue(item);
  };

  getMpList = () => {
    let wx_url = this.props.add.configJson.weixinUrl;

    if (wx_url && this.state.mplist.length == 0) {
      weixinMpList(wx_url).then(res => {
        if (res.data.code === 200) {
          this.setState({
            mplist: res.data.data
          });
        }
      });
    }
  };
  /**
   * 树选择
   */
  onChange = (value, label, extra) => {
    console.log(value);
    console.log(label);
    console.log(extra);
    localStorage.setItem("treeSelectedKeys", extra.triggerNode.props.eventKey);
    localStorage.setItem("treeSelectedValue", value);
  };

  onChangeRadio = e => {
    this.setState({
      radioValue: e.target.value,
      editDatas: []
    });
    this.props.form.setFieldsValue({
      is_original: e.target.value
    });
  };
  onChangeRadio2 = e => {
    this.setState({
      radioValue2: e.target.value,
      editDatas: []
    });
    this.props.form.setFieldsValue({
      is_crond: e.target.value
    });
  };

  onChangeRadio3 = e => {
    this.setState({
      radioValue3: e.target.value,
      editDatas: []
    });
    this.props.form.setFieldsValue({
      is_lower_crond: e.target.value
    });
  };
  getFieldsValueTab = () => {
    let data = this.props.form.getFieldsValue();
    return data;
  };
  /**
   * 获取表单的值
   */
  getFieldsValue = () => {
    let data = this.props.form.getFieldsValue();
    this.props.form.validateFields();
    let intro = document.getElementById("original_intro").innerText;
    console.log(intro);
    data.original_intro = intro;
    if (data.about_artical) {
      data.about_artical.map((item, index) => {
        data[item] = 1;
      });
    }
    if (data.about_artical.indexOf("is_comment") < 0) {
      data.is_comment = 0;
    }
    if (data.about_artical.indexOf("is_reprint") < 0) {
      data.is_reprint = 0;
    }
    if (data.about_artical.indexOf("is_ad") < 0) {
      data.is_ad = 0;
    }
    if (data.about_artical.indexOf("is_check_comment") < 0) {
      data.is_check_comment = 0;
    }

    if (this.state.showCover === 2) {
      let arr = data.information_img.split(",");
      if (arr.length < 3) {
        message.error("3图模式，封面图不能少于3张.");
        return false;
      }
    }

    if (
      this.props.theme.params.class == "theme" ||
      this.props.theme.params.class == "theme_edit"
    ) {
      //判断是否是专题资讯
      if (this.state.showCover === 3) {
        //是否是无图上传
        return data;
      } else {
        if (data.information_img) {
          return data;
        }
      }
    } else {
      let validateArr = this.props.form.getFieldsError();
      let isDown = true;
      for (const key in validateArr) {
        if (validateArr.hasOwnProperty(key)) {
          //判断是否有效验错误
          if (validateArr[key]) {
            isDown = false;
            return;
          }
        }
      }
      if (isDown) {
        return data;
      }
    }
  };
  /**
   * 重置表单
   */
  resetFields = () => {
    this.props.form.resetFields();
    this.setState({
      editDatas: []
    });
  };

  /**
   * 设置默认版面
   */
  setBanMianFields = data => {
    this.props.form.setFieldsValue(data);
  };

  /**
   * 引用mch设置默认版面
   */
  setEditor = data => {
    if (data.type == "biz_sobey_video") {
      let mch_img = data.keyFrameUrl;

      if (mch_img) {
        if (this.state.showCover !== 3) {
          let img_arr = this.state.editDatas;

          if (img_arr.length <= 0) {
            img_arr.push(mch_img);
            this.setState({
              showCover: 1,
              editDatas: img_arr
            });
            this.props.form.setFieldsValue({
              information_img: mch_img
            });
          } else if (this.state.showCover === 2) {
            if (img_arr.length <= 2) {
              img_arr.push(mch_img);
              this.setState({
                editDatas: img_arr
              });
              this.props.form.setFieldsValue({
                information_img: img_arr.join()
              });
            }
          }
        }
      }
    }
  };
  /**
   * 设置表单值
   */
  setFields = data => {
    //已发布视频不覆盖数据
    if (data.mType && (data.mType == "video" || data.mType == "information")) {
      let formData = this.props.form.getFieldsValue();
      if (formData.information_img && formData.information_img != noImg) {
        data.information_img = formData.information_img;
      } else {
        let img = data.information_img;
        if (img) {
          let imgUrl = img.split(",");
          if (imgUrl.length > 1) {
            this.setState({
              showCover: 2,
              editDatas: imgUrl
            });
          } else {
            this.setState({
              showCover: 1,
              editDatas: imgUrl
            });
          }
        } else {
          this.setState({
            showCover: 3
          });
        }
        this.props.form.setFieldsValue(data);
      }

      return;
    }
    document.getElementById("original_intro").innerText=data.original_intro
    let img = data.information_img;
    if (img) {
      let imgUrl = img.split(",");
      if (imgUrl.length > 1) {
        this.setState({
          showCover: 2,
          editDatas: imgUrl
        });
      } else {
        this.setState({
          showCover: 1,
          editDatas: imgUrl
        });
      }
    } else {
      this.setState({
        showCover: 3
      });
    }
    if (data.original_url) {
      this.setState({
        radioValue: 2
      });
    }
    if (data.is_crond == 1) {
      this.setState({
        radioValue2: 1
      });
      if (data.crond_time) {
        data.crond_time = moment(data.crond_time, "YYYY-MM-DD HH:mm:ss");
      }
    }
    if (data.is_lower_crond == 1) {
      this.setState({
        radioValue3: 1
      });
      if (data.lower_crond_time) {
        data.lower_crond_time = moment(
          data.lower_crond_time,
          "YYYY-MM-DD HH:mm:ss"
        );
      }
    }

    data["about_artical"] = [];
    if (data.is_comment == 1) {
      data.about_artical.push("is_comment");
    }
    if (data.is_reprint == 1) {
      data.about_artical.push("is_reprint");
    }
    if (data.is_ad == 1) {
      data.about_artical.push("is_ad");
    }
    if (data.is_check_comment == 1) {
      data.about_artical.push("is_check_comment");
    }
    this.props.form.setFieldsValue(data);
  };
  /**
   * 封面上传控制
   */
  showCover = e => {
    let show = e.target.value;
    this.setState({
      showCover: show,
      editDatas: []
    });

    this.props.form.setFieldsValue({
      information_img: ""
    });
  };
  /**
   * inputNumber 受控
   */
  scanNum = value => {
    this.setState({
      scanNum: value
    });
  };
  forwardNum = value => {
    this.setState({
      forwardNum: value
    });
  };
  thumbsNum = value => {
    this.setState({
      thumbsNum: value
    });
  };
  render() {
    const { getFieldDecorator } = this.props.form;
    const { plateList, classList,configJson } = this.props.add;
    let data = [];

    plateList.map((item, index) => {
      let obj = {
        key: item.key,
        plate_id: item.plate_id,
        title: configJson && configJson.is_mengwen && item.sub_title ? item.sub_title : item.title,
        children: item.children ? item.children : [],
        value: item.value,
        disabled: item.children && item.children.length > 0 ? true : false
      };
      //去除版面是banner样式的子版面和子版面全是banner的父版面

      // if (item.template_conf.indexOf("banner") > -1  && obj.children.length==0) {
      //
      // }else{
      if (item.children && item.children.length > 0) {
        let child_obj = [];
        item.children.map((i, ins) => {
          // if ((i.template_conf.indexOf("banner") === -1 )) {
          let obj2 = {
            key: i.key,
            plate_id: i.plate_id,
            title: configJson && configJson.is_mengwen && i.sub_title ? i.sub_title : i.title,
            value: i.value,
            template_id: i.template_id,
            template_conf: i.template_conf
          };
          child_obj.push(obj2);
          // }
        });
        if (child_obj.length > 0) {
          obj.children = child_obj;
          data.push(obj);
        }
      } else {
        data.push(obj);
      }

      // }
    });

    let plateList1 = data;

    //正则匹配经度
    const myValidateFields = (rule, values, callback) => {
      var reg = /^[\-\+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,5})$/;
      if (values) {
        if (!reg.test(values)) {
          callback("请输入正确经度");
        }
      }
      callback();
    };
    //正则匹配纬度
    const myValidateField = (rule, values, callback) => {
      var reg = /^[\-\+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,5})$/;
      if (values) {
        if (!reg.test(values)) {
          callback("请输入正确的纬度");
        }
      }
      callback();
    };
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 12 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 12 }
      }
    };

    // console.log(this.state.thumbsNumPro);

    let { thumbsNumPro, forwardNumPro, scanNumPro } = this.state;
    if (!thumbsNumPro) thumbsNumPro = 0;
    if (!forwardNumPro) forwardNumPro = 0;
    if (!scanNumPro) scanNumPro = 0;

    return (
      <div className="righttwo2">
        <div className="righttwo_top">
          <Form>
            {/* 纬度 */}
            <FormItem {...formItemLayout} label="ᠥᠷᠭᠡᠷᠢᠭ">
              {getFieldDecorator("latitude", {
                rules: [
                  {
                    validator: myValidateField
                  }
                ]
              })(<Input size="small" placeholder="-90.0～+90.0" />)}
            </FormItem>
            {/* 经度 */}
            <FormItem {...formItemLayout} label="ᠤᠷᠲᠤᠷᠢᠭ">
              {getFieldDecorator("longitude", {
                rules: [
                  {
                    validator: myValidateFields
                  }
                ]
              })(<Input size="small" placeholder="-180.0～+180.0" />)}
            </FormItem>
            {/* 位置 */}
            <FormItem {...formItemLayout} label="ᠪᠠᠢᠷᠢ">
              {getFieldDecorator("position")(<Input size="small" />)}
            </FormItem>
            {/* 来源 */}
            <FormItem {...formItemLayout} label=" ᠢᠷᠡᠯᠲᠡ">
              {getFieldDecorator("resource")(
                <Input placeholder="ᠢᠷᠡᠯᠲᠡ  ᠵᠢ ᠪᠢᠴᠢ" size="small" />
              )}
            </FormItem>
            {/**记者 */}
            <FormItem {...formItemLayout} label="ᠰᠤᠷᠪᠤᠯᠵᠢᠯᠠᠭᠴᠢ">
              {getFieldDecorator("reporter")(
                <Input
                  placeholder="ᠰᠤᠷᠪᠤᠯᠵᠢᠯᠠᠭᠴᠢ ᠶ᠋ᠢᠨ ᠨᠡᠷ᠎ᠡ ᠵᠢ ᠤᠷᠤᠭᠤᠯ"
                  size="small"
                />
              )}
            </FormItem>
            {/**编辑 */}
            <FormItem {...formItemLayout} label="ᠨᠠᠢᠷᠠᠭᠤᠯᠤᠭᠴᠢ">
              {getFieldDecorator("editor")(
                <Input placeholder="ᠪᠡᠨ  ᠪᠢᠴᠢᠭᠡᠷᠡᠢ ᠨᠠᠢᠷᠠᠭᠤᠯᠬᠤ" size="small" />
              )}
            </FormItem>
            {(this.props.theme.params.class &&
              this.props.theme.params.class == "theme") ||
            this.props.theme.params.class == "theme_edit" ? (
              []
            ) : (
              <FormItem {...formItemLayout} label="ᠮᠡᠳᠡᠭᠡ ᠶ᠋ᠢᠨ ᠨᠢᠭᠤᠷ">
                {/**资讯版面 */}
                {getFieldDecorator("plate_id", {
                  rules: [
                    {
                      required: true,
                      message: " ᠢ᠋ᠶ᠋ᠠᠨ ᠰᠣᠩᠭᠤᠭᠠᠷᠠᠢ ᠮᠡᠳᠡᠭᠡᠯᠡᠯ ᠦ᠋ᠨ ᠨᠢᠭᠤᠷ"
                    }
                  ]
                })(
                  <TreeSelect
                    size="small"
                    dropdownStyle={{
                      maxHeight: 400,
                      transform: "rotate(90deg)"
                    }}
                    dropdownMatchSelectWidth
                    placeholder="ᠮᠡᠳᠡᠭᠡᠯᠡᠯ ᠦ᠋ᠨ ᠨᠢᠭᠤᠷ ᠢ᠋ᠶ᠋ᠠᠨ ᠰᠣᠩᠭᠤᠬᠤ"
                    treeData={plateList1}
                    multiple
                    treeDefaultExpandAll
                    onChange={this.onChange}
                    allowClear
                    multiple
                  />
                )}
              </FormItem>
            )}
            {(this.props.theme.params.class &&
              this.props.theme.params.class == "theme") ||
            this.props.theme.params.class == "theme_edit" ? (
              []
            ) : (
              <FormItem
                {...formItemLayout}
                label="ᠮᠡᠳᠡᠭᠡ  ᠶ᠋ᠢᠨ ᠠᠩᠭᠢᠯᠠᠯ"
              >
                {/**请选择资讯分类 */}
                {getFieldDecorator("class_id", {
                  rules: [
                    {
                      required: true,
                      message:
                        "ᠮᠡᠳᠡᠭᠡ  ᠵᠠᠩᠭᠢ ᠶ᠋ᠢᠨ ᠬᠤᠪᠢᠶᠠᠷᠢᠯᠠᠯ ᠢ᠋ᠶ᠋ᠠᠨ ᠰᠣᠩᠭᠤᠭᠠᠷᠠᠢ"
                    }
                  ]
                })(
                  <Select
                    placeholder="ᠮᠡᠳᠡᠭᠡ  ᠶ᠋ᠢᠨ  ᠠᠩᠭᠢᠯᠠᠯ ᠡᠴᠡ ᠰᠣᠩᠭᠤᠬᠤ"
                    size="small"
                    dropdownStyle={{
                      maxHeight: 400,
                      transform: "rotate(90deg)"
                    }}
                  >
                    {classList.map((item, index) => {
                      return (
                        <Option key={index} value={item.class_id}>
                          {item.class_name}
                        </Option>
                      );
                    })}
                  </Select>
                )}
              </FormItem>
            )}

            <FormItem {...formItemLayout} label="">
              {/**请上传封面图片 */}
              {getFieldDecorator("information_img", {
                rules: [
                  {
                    required: this.state.showCover === 3 ? false : true,
                    message: "请上传封面图片"
                  }
                ]
              })(<Input style={{ display: "none" }} />)}
            </FormItem>

            <h3>
              <span
                style={
                  this.state.showCover === 3
                    ? { display: "none" }
                    : { color: "red" }
                }
              >
                {this.state.showCover === 3 ? (
                  ""
                ) : (
                  <UploadDu
                    one={this.state.showCover}
                    form={this.props.form}
                    isEdit={this.state.editDatas}
                  />
                )}
                <RadioGroup
                  onChange={this.showCover}
                  value={this.state.showCover}
                  style={{ marginBottom: "12px" }}
                >
                  <Radio value={1}>ᠨᠢᠭᠡ ᠵᠢᠷᠤᠭᠲᠤ ᠭᠠᠳᠠᠷ</Radio>
                  {/**一图封面 */}
                  {/* <Radio value={2}>三图封面</Radio>
                    <Radio value={3}>无图</Radio> */}
                </RadioGroup>
              </span>
            </h3>
            {/**封面 */}
            <h3>
              <span className="required" style={{ color: "red" }}>
                *
              </span>
              ᠭᠠᠳᠠᠷ ᠬᠠᠪᠲᠠᠰᠤ
            </h3>
            {/**基本信息 */}
            <h3>ᠦᠨᠳᠦᠰᠦᠨ ᠰᠤᠷᠠᠭ</h3>
          </Form>
        </div>
        <div className="righttwo_down">
          <Form>
            {/* 点赞量 */}
            <FormItem
              label={
                <span className="title">
                  ᠰᠠᠢᠰᠢᠶᠠᠭᠰᠠᠨ ᠲᠣᠭ᠎ᠠ
                  <span className="hs">
                    (ᠰᠠᠢᠰᠢᠶᠠᠭᠰᠠᠨ ᠲᠣᠭ᠎ᠠ= ᠰᠠᠭᠤᠷᠢ ᠲᠣᠭ᠎ᠠ+ ᠢᠯᠡᠳᠭᠡᠮᠵᠢ  ᠲᠣᠭ᠎ᠠ ᠪᠤᠲᠠᠳᠠᠢ ᠲᠣᠭ᠎ᠠ)
                  </span>
                </span>
              }
            >
              <div>
                {getFieldDecorator("default_thumbs_up_num", {
                  initialValue: 0
                })(
                  <InputNumber
                    placeholder="ᠦᠨᠳᠦᠰᠦᠨ ᠲᠣᠭ᠎"
                    min={0}
                    style={{ width: "65px" }}
                    onChange={this.thumbsNum}
                  />
                )}
                +{" "}
                {getFieldDecorator("thumbs_up_coefficient", {
                  initialValue: 1
                })(
                  <InputNumber
                    placeholder=" ᠦᠨᠳᠦᠰᠦᠨ ᠲᠣᠭ᠎"
                    min={0}
                    style={{ width: "65px" }}
                    onChange={this.thumbsNum}
                  />
                )}{" "}
                * {thumbsNumPro}（ ᠪᠤᠲᠠᠲᠠᠢ ᠲᠣᠭ᠎ᠠ） ={" "}
                {thumbsNumPro *
                  parseInt(
                    this.props.form.getFieldValue("thumbs_up_coefficient")
                  ) +
                  parseInt(
                    this.props.form.getFieldValue("default_thumbs_up_num")
                  )}
              </div>
            </FormItem>
            {/* 转发量 */}
            <FormItem
              label={
                <span className="title">
                 ᠳᠠᠮᠵᠢᠭᠤᠯᠤᠭᠰᠠᠨ ᠲᠣᠭ᠎ᠠ
                  <span className="hs">
                    ( ᠳᠠᠮᠵᠢᠭᠤᠯᠤᠭᠰᠠᠨ ᠲᠣᠭ᠎ᠠ= ᠰᠠᠭᠤᠷᠢ ᠲᠣᠭ᠎ᠠ+ ᠢᠯᠡᠳᠭᠡᠮᠵᠢ ᠲᠣᠭ᠎ᠠ ᠪᠤᠲᠠᠳᠠᠢ ᠲᠣᠭ᠎ᠠ)
                  </span>
                </span>
              }
            >
              <span>
                {getFieldDecorator("default_forward_num", { initialValue: 0 })(
                  <InputNumber
                    placeholder="ᠦᠨᠳᠦᠰᠦᠨ ᠲᠣᠭ᠎ᠠ"
                    min={0}
                    style={{ width: "65px" }}
                    onChange={this.forwardNum}
                  />
                )}
                +{" "}
                {getFieldDecorator("forward_coefficient", { initialValue: 1 })(
                  <InputNumber
                    placeholder="ᠢᠯᠡᠳᠭᠡᠮᠵᠢ"
                    min={0}
                    style={{ width: "65px" }}
                    onChange={this.scanNum}
                  />
                )}{" "}
                * {forwardNumPro}（ᠪᠤᠲᠠᠲᠠᠢ ᠲᠣᠭ᠎ᠠ） ={" "}
                {forwardNumPro *
                  parseInt(
                    this.props.form.getFieldValue("forward_coefficient")
                  ) +
                  parseInt(
                    this.props.form.getFieldValue("default_forward_num")
                  )}
              </span>
            </FormItem>
            {/* 点击量 */}
            <FormItem
              label={
                <span className="title">
                  ᠳᠠᠷᠥᠮ ᠶ᠋ᠢᠨ ᠲᠣᠭ᠎ᠠ
                  <span className="hs">
                  (ᠳᠠᠷᠥᠮ ᠶ᠋ᠢᠨ  ᠲᠣᠭ᠎ᠠ= ᠰᠠᠭᠤᠷᠢ ᠲᠣᠭ᠎ᠠ+ ᠢᠯᠡᠳᠭᠡᠮᠵᠢ ᠲᠣᠭ᠎ᠠ ᠪᠤᠲᠠᠳᠠᠢ ᠲᠣᠭ᠎ᠠ)
                  </span>
                </span>
              }
            >
              <span>
                {getFieldDecorator("default_scan_num", { initialValue: 0 })(
                  <InputNumber
                    placeholder="ᠦᠨᠳᠦᠰᠦᠨ ᠲᠣᠭ᠎ᠠ"
                    min={0}
                    style={{ width: "65px" }}
                    onChange={this.scanNum}
                  />
                )}
                +{" "}
                {getFieldDecorator("scan_coefficient", { initialValue: 1 })(
                  <InputNumber
                    placeholder="ᠢᠯᠡᠳᠭᠡᠮᠵᠢ"
                    min={0}
                    style={{ width: "65px" }}
                    onChange={this.scanNum}
                  />
                )}{" "}
                * {scanNumPro}（ ᠪᠤᠲᠠᠲᠠᠢ ᠲᠣᠭ᠎ᠠ） ={" "}
                {scanNumPro *
                  parseInt(this.props.form.getFieldValue("scan_coefficient")) +
                  parseInt(this.props.form.getFieldValue("default_scan_num"))}
              </span>
            </FormItem>
            <Divider />
            {/* 下架时间 */}
            <FormItem
              {...formItemLayout}
              label="ᠳᠣᠷᠣᠭᠰᠢ ᠪᠠᠭᠤᠬᠤ ᠴᠠᠭ"
              style={this.state.radioValue3 != 1 ? { display: "none" } : {}}
            >
              {getFieldDecorator("lower_crond_time")(
                <DatePicker
                  style={{ width: "200px" }}
                  showTime
                  format="YYYY-MM-DD HH:mm:ss"
                  placeholder="ᠴᠠᠭ"
                />
              )}
            </FormItem>
            <FormItem {...formItemLayout} label="ᠲᠣᠭᠲᠠᠭᠰᠠᠨ ᠴᠠᠭ ᠲᠤ᠌  ᠬᠠᠰᠤᠬᠤ">
              {getFieldDecorator("is_lower_crond", { initialValue: 0 })(
                <RadioGroup onChange={this.onChangeRadio3}>
                  <Radio value={1}>ᠲᠡᠢᠮᠦ</Radio>
                  <Radio value={0}>ᠪᠢᠰᠢ</Radio>
                </RadioGroup>
              )}
            </FormItem>
            <Divider />
            <FormItem
              {...formItemLayout}
              label="ᠵᠢᠶᠠᠰᠠᠨ ᠳᠤ ᠭᠠᠷᠬᠤ ᠴᠠᠭ"
              style={this.state.radioValue2 != 1 ? { display: "none" } : {}}
            >
              {getFieldDecorator("crond_time")(
                <DatePicker
                  style={{ width: "200px" }}
                  showTime
                  format="YYYY-MM-DD HH:mm:ss"
                  placeholder="ᠴᠠᠭ"
                />
              )}
            </FormItem>
            <FormItem {...formItemLayout} label="ᠲᠣᠭᠲᠠᠭᠰᠠᠨ  ᠴᠠᠭ ᠲᠤ᠌ ᠨᠡᠢᠲᠡᠯᠡᠬᠦ">
              {getFieldDecorator("is_crond", { initialValue: 0 })(
                <RadioGroup onChange={this.onChangeRadio2}>
                  <Radio value={1}>ᠲᠡᠢᠮᠦ</Radio>
                  <Radio value={0}>ᠪᠢᠰᠢ</Radio>
                </RadioGroup>
              )}
            </FormItem>
            <Divider />
            <FormItem
              {...formItemLayout}
              label="ᠡᠬᠡ ᠪᠢᠴᠢᠭ ᠦᠨ ᠴᠥᠷᠬᠡᠯᠡᠭᠡ"
              style={this.state.radioValue === 1 ? { display: "none" } : {}}
            >
              {getFieldDecorator("original_url")(
                <TextArea
                  placeholder="ᠡᠬᠡ ᠪᠢᠴᠢᠭ ᠦᠨ ᠴᠥᠷᠬᠡᠯᠡᠭᠡ"
                  autosize={{ minRows: 1, maxRows: 3 }}
                />
              )}
            </FormItem>
            {/* 原创声明 */}
            <FormItem
              {...formItemLayout}
              label="ᠤᠤᠯ ᠪᠦᠲᠦᠭᠡᠯ ᠦ᠋ᠨ ᠢᠯᠡᠷᠬᠡᠢᠯᠡᠯᠲᠡ"
              style={this.state.radioValue === 2 ? { display: "none" } : {}}
            >
              <p
                id="original_intro"
                contenteditable="true"
                className="original_intro"
              ></p>
            </FormItem>
            {/* 是否原创 */}
            <FormItem {...formItemLayout} label="ᠤᠤᠯ ᠪᠦᠲᠦᠭᠡᠯ ᠮᠥᠨ ᠡᠰᠡᠬᠦ">
              {getFieldDecorator("is_original", { initialValue: 1 })(
                <RadioGroup onChange={this.onChangeRadio}>
                  <Radio value={1}>ᠲᠡᠢᠮᠦ</Radio>
                  <Radio value={2}>ᠪᠢᠰᠢ</Radio>
                </RadioGroup>
              )}
            </FormItem>
            <Divider />
            <FormItem>
              {getFieldDecorator("about_artical", {
                initialValue: ["is_comment", "is_reprint", "is_ad"]
              })(
                <Checkbox.Group style={{ width: "100%" }}>
                  <Row>
                    <Col span={24}>
                      {/* 允许评论 */}
                      <Checkbox value="is_comment">
                      ᠰᠢᠭᠦᠮᠵᠢ ᠪᠢᠴᠢᠭᠡᠷᠡᠢ
                      </Checkbox>
                    </Col>
                    {/* <Col span={24}><Checkbox value="is_ad">允许广告</Checkbox></Col> */}
                    <Col span={24}>
                      <Checkbox value="is_check_comment">
                        ᠰᠢᠭᠦᠮᠵᠢ ᠶ᠋ᠢ ᠬᠢᠨᠠᠬᠤ
                      </Checkbox>
                    </Col>
                    <Col span={24}>
                      <Checkbox value="is_reprint">ᠳᠠᠮᠵᠢᠭᠤᠯᠬᠤ  ᠵᠢ ᠵᠥᠪᠰᠢᠶᠡᠷᠡᠬᠦ ( ᠬᠤᠪᠢᠶᠠᠯᠴᠠᠬᠤ)</Checkbox>
                    </Col>
                  </Row>
                </Checkbox.Group>
              )}
            </FormItem>
            <h3>ᠵᠣᠬᠢᠶᠠᠯ ᠤ᠋ᠨ ᠲᠣᠬᠢᠷᠠᠭᠤᠯᠤᠯᠲᠠ</h3>

            {/* <Divider />
            {this.props.add.configJson.weixinPushSwitch &&
            this.props.add.configJson.weixinUrl ? (
              <FormItem label="选择推送的公众号">
                {getFieldDecorator("weixin_mpid")(
                  <Checkbox.Group>
                    <Row>
                      {this.state.mplist.map(item => {
                        return (
                          <div>
                            <Col
                              key={item.id}
                              style={{ marginBottom: "15px", width: "100%" }}
                              span={8}
                            >
                              <Checkbox value={item.id}>{item.name}</Checkbox>
                            </Col>
                          </div>
                        );
                      })}
                    </Row>
                  </Checkbox.Group>
                )}
              </FormItem>
            ) : (
              ""
            )} */}
          </Form>
        </div>
      </div>
    );
  }
}

const RightTwos = Form.create()(RightTwo);
export default RightTwos;
